package ace.module.captcha.sms.sdk.core.feign.impl.client;

import ace.cmp.core.model.R;
import ace.module.captcha.sms.api.CaptchaSmsOpenApi;
import ace.module.captcha.sms.sdk.core.constant.SdkConstant;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author caspar
 * @date 2023/3/17 15:49
 */
@FeignClient(
    name = "${spring.cloud.openfeign.client.captchaSmsClientFeign.name:" + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "captchaSmsClientFeign",
    path = CaptchaSmsClientFeign.PATH
)
public interface CaptchaSmsClientFeign extends CaptchaSmsOpenApi {

  String DEFAULT_PATH = "/captcha-sms/client";
  String PATH = "${spring.cloud.openfeign.client.captchaSmsClientFeign.path:" + DEFAULT_PATH + "}";
  String PATH_SEND = "/send";
  String URI_SEND = DEFAULT_PATH + PATH_SEND;

  @Operation(summary = "发送短信验证码", description = "data=验证码")
  @PostMapping(path = PATH_SEND)
  R<Void> send(
      @Valid @NotNull @RequestParam("captchaSmsAppId") Long captchaSmsAppId,
      @Valid @NotBlank @RequestParam("phone") String phone);

}
